<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="信息栏目" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<link href="/css/dtree.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	background: url(images/leftmenu-bg.gif);
}
-->
</style>
</head>
<script src="/js/dtree.js"></script>
<script language="javascript">
	function doNew(){
		var url="/bbs/BbsColumnNew.ihtm";
		parent.ShowIframeNoScroll("栏目",url,300,260,"refreshColWin()");//refreshColWin是父窗口的
	}
	function doEdit(){
		var id=document.getElementById("currentId").value;
		if(id==""){
			parent.ShowAlert('提示框','请选择要修改的栏目',200,100);
		}else{
			var url="/bbs/BbsColumnEdit.ihtm?id="+id;
			parent.ShowIframeNoScroll("栏目",url,300,260,"refreshColWin()");//refreshColWin是父窗口的
		}
	}
	function doDelete(){
		var id=document.getElementById("currentId").value;
		if(id==""){
			parent.ShowAlert('提示框','请选择要删除的栏目',200,100);
		}else{
			parent.ShowConfirm('确认框','确定删除吗？',340,80,"doDelCol("+id+")");//doDelCol是父窗口的
		}
	}
	function doTreeNodeClick(id){
		document.getElementById("currentId").value=id;
		parent.document.getElementById("mainFrame").src="/bbs/BbsTopicList.ihtm?column_id="+id;
	}
	function doInit(){
		var defaultId="${defaultId}";
		var defaultUrl="${defaultUrl}";
		if(defaultId!=""){
			if(defaultUrl!=""){
				parent.document.getElementById("mainFrame").src=defaultUrl;
			}else{
				doTreeNodeClick(defaultId);
			}
			d.openTo(defaultId,true,false);
		}
	}
</script>
</head>
<body oncontextmenu="return false" onLoad="doInit();" style="text-align:center" scroll="no">
	<div class="nav" id="scrollDiv" style="text-align:left;overflow-x:hidden;overflow-y:auto;height:468px;width:190px">
		<h3 class="title">信息栏目</h3>
		<div class="nav-link nav-mail" style="width:100%">
		  	<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';BBS_COLU;')!=-1}">
					<img src="/images/icon_add.gif" border="0" title="新增栏目" onClick="doNew();" style='cursor:pointer;'/>&nbsp;
					<img src="/images/icon_edit.gif" border="0" title="修改栏目" onClick="doEdit();" style='cursor:pointer;'/>&nbsp;
					<img src="/images/icon_del.gif" border="0" title="删除栏目" onClick="doDelete();" style='cursor:pointer;'/>
					<div class="blank12"></div>
			</c:if>
			<input type="hidden" id="currentId" name="currentId" value="${defaultId}">
			<c:if test="${alertMsg!=null && alertMsg!=''}">
				<div class="msg-error" id="errorMsgTd">${alertMsg}</div>
				<c:remove var="alertMsg" scope="session" />
			</c:if>
			<script language="javascript">
			<!--
			var isOpen=false;
			var d = new dTree('d','/images/dtree');
			
			d.config.useCookies=false;
			d.config.useLines=false;
			d.config.useIcons=false;
			
			d.add(0,-1,'Root');
			<c:forEach var="item" items="${list}">
				d.add(${item.id},0,'${item.columnName}',"javascript:doTreeNodeClick('${item.id}');",'','','',false);
			</c:forEach>
			
			document.write(d);
			d.closeAll();
			//-->
			</script>	
		</div>
	</div>
</body>
</html>